Skip to content

Fix output width: no horizontal scroll, use full column width, shorter nav - #9

Merged
HarryCordewener merged 1 commit into
masterfrom
fix/naws-no-horizontal-scroll
Jul 1, 2026
Merged

Fix output width: no horizontal scroll, use full column width, shorter nav#9
HarryCordewener merged 1 commit into
masterfrom
fix/naws-no-horizontal-scroll

Conversation

@HarryCordewener

@HarryCordewener HarryCordewener commented Jun 30, 2026

Copy link
Copy Markdown
Member

Symptom

Output fits 78 columns but there's a left/right scrollbar; you have to center the scroll to see all 78, instead of long lines wrapping.

Root cause (corrected)

My first attempt swapped the min-width track from 1ch to a measured px value on a "1ch rounds ~2px wider" theory. That was wrong — verified in Chrome that for JetBrains Mono 78ch (378.786px) and the measured 78-glyph run (378.789px) are sub-pixel identical. The track was never meaningfully too wide.

The scroll came from the page allowing it (as @user pointed out):

  • .sc-output had a forced min-width column track, and
  • .sc-output-area had overflow-x: auto.

So any excess width — sub-pixel, or Android WebView font-boosting inflating text beyond the size measureGrid fitted the grid to — turned into a horizontal scrollbar.

Fix (wrap, never scroll sideways)

  • Remove the min-width track from .sc-output — nothing forces the block wider than its box; lines wrap at the fitted column width.
  • .sc-output-area overflow-x: autohidden — the page can't scroll horizontally; residual excess is clipped, not scrolled.
  • text-size-adjust: 100% on html/body — stops the Android WebView auto-inflating text (the device-only reason real lines exceeded the fitted grid).
  • Let .sc-link buttons wrap (white-space: normal; overflow-wrap: anywhere) so a long command link can't be the one element that refuses to wrap.
  • Revert the unused --sc-cols-width JS from the first commit.

Verification

Reproduced the layout in a standalone harness and inspected in Chrome at 360 / 393 / 412px widths with a long link button and simulated font-boosting: no horizontal scrollbar; content wraps. CSS/JS only; no C# changes; Web builds clean.

🤖 Generated with Claude Code

The font is fitted from a measured 200-char glyph run so exactly MinColumns
(78) columns span the content box. But the min-width track that holds those
columns used the CSS `ch` unit (`calc(var(--sc-cols) * 1ch)`), whose single-
glyph advance rounds ~2px wider than the averaged run. So `78ch` exceeded the
box by a couple px and .sc-output-area's overflow-x:auto showed a permanent
tiny horizontal scrollbar — you had to center the scroll to see all 78, and
long lines scrolled instead of wrapping at the column edge.

measureGrid now publishes the track width in pixels (--sc-cols-width),
measured from a real run of `cols` glyphs at the fitted size — the same basis
the font was fitted to. .sc-output min-width uses that px value instead of
1ch. In the fitting case the track stays inside the box (no scroll; lines wrap
at column 78); it only exceeds the box and scrolls when the screen genuinely
can't fit the columns at the minimum font, which is the intended fallback.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HHCRc5CJ6595iMzEgYYdQp
@HarryCordewener
HarryCordewener merged commit 1ad3845 into master Jul 1, 2026
2 checks passed
@HarryCordewener HarryCordewener changed the title Fix spurious horizontal scroll on the output column track Stop the output area from scrolling horizontally (wrap instead) Jul 1, 2026
@HarryCordewener HarryCordewener changed the title Stop the output area from scrolling horizontally (wrap instead) Fix output width: no horizontal scroll, use full column width, shorter nav Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant